<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script src="bower_components/jquery/dist/jquery.min.js"></script>
		<script src="js/jq.cookie.js"></script>
	</head>
	<style>
		.dropdown{
			width: 100%;
			height: 30px;
		}
		#save{
			border: none;
			height: 30px;
		}
	</style>
	<body>
		<div style="text-align: center;margin-top:50px;">
		<table class="open_tabel" style="margin-top:20px;width:90%;margin:0 auto;">
			<tr>
				<td style="max-width: 50px;">项目</td>
				<td>
				<select class="ui fluid search dropdown" id="ProjectMenu">
				</select>
				</td>				
			</tr>
		</table>
			<button type="button" id="save" class="ui button" style="background: #3c8dbc;color: white;cursor: pointer;width:100px;margin-top:50px;">断货打标</button>

		</div>
	</body>
</html>
<script>
	$(document).ready(function(){
		var index = parent.layer.getFrameIndex(window.name);
		$.ajax({
			type:"get",
			url:"http://www.duoweish.com/apis/SalesInfo/",
			async:true,
			success:function(data){
				for (var i = 0;i<data[1].length;i++) {
					$("#ProjectMenu").append('<option value="'+ data[1][i] +'">'+ data[1][i] + '</option>'); 
				}
			}
		});
		
		$("#save").click(function(){
			
			var new_data = $("#ProjectMenu").val();
			$.ajax({
				type:"get",
				url:"http://www.duoweish.com/apis/NewStock/",
				async:true,
				data:{
					UserId:$.cookie('ID'),
					Project:new_data
				},
				success:function(){
					parent.layer.msg('打标成功');
					parent.$('#Info').empty();
					parent.$.Ajax(1);
					parent.layer.close(index);
					
				}
			});
		})
	})
</script>
